package com.itboy.controller;

import com.itboy.pojo.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class helloController {
    //添加配置文件依赖 用value
    @Value("${personName}")
    private String pername;
    //依赖注入配置文件对象
    @Autowired
    private Person person;
    @GetMapping("/hello")
    public String hello(){
        return "hello world";
    }
    @GetMapping("/pername")
    public String getPername(){
        return pername;
    }
    @GetMapping("/person")
    public Person getPerson(){
        return person;
    }
}
